#
# 'make'        build executable file 'main'
# 'make clean'  removes all .log and executable files
#

# global settings

CXX := g++
CXXFLAGS := -O0 -g -Wall -Werror

OUTPUT := output
SOURCES := src/*.cpp
INCLUDES := -Iinclude
MAIN := $(OUTPUT)/main

RM := rm -rf
MD := mkdir -p

# directory of test samples
testcase_BIN := input/large-scale_UU

# rules for building the project

all: $(MAIN)
	@echo Executing 'all' complete!

$(MAIN): $(SOURCES) $(OUTPUT)
	$(CXX) $(CXXFLAGS) $(INCLUDES) $(SOURCES) -o $(MAIN)

$(OUTPUT):
	$(MD) $(OUTPUT)

# suffix replacement rule for building the project

test: all $(testcase_BIN)
	python3 driver.py $(testcase_BIN)
	@echo Executing 'test: all' complete!

run: all
	python3 driver.py
	@echo Executing 'run: all' complete!

clean:
	$(RM) $(OUTPUT) 2> /dev/null
	@echo Cleanup complete!